<include file="Public:header" />
<include file="Public:leftside" />
<style>
  .pagination a{display: block;float: left;border: 1px solid #eee;padding: 2px 4px;margin: 0 2px;}
  .pagination span{display: block;float: left;border: 1px solid #eee;padding: 2px 4px;margin: 0 2px;background: #65bd77;color: #fff;}
</style>
<div class="main-content">
	<div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
		<ul class="breadcrumb">
			<li> <i class="icon-home home-icon"></i> <a href="/">首页</a> </li>
			<li><a href="javascript:;">店铺提现</a></li>
	
		</ul>
	</div>
	<div class="page-content">
 
    <section class="panel-default m-b-sm" style="width: 100%;margin: 5px auto;">
        <div class="alert alert-info">
            <p>
              <i class="fa fa-hand-o-right m-r-xs"></i><strong>操作提示</strong>
            </p>
            <p class="alert-p m-l-xl"><i class="fa fa-caret-right m-r-xs"></i>该页面可对店铺提现进行审核转账。</p>
            
        </div>
     </section>
    <div class="listContent">

    	<div class="wrap js-check-wrap">
     <form class="well form-search" method="post" action="{:U('Finance/store_withdrawal')}">
      	订单状态： 
      <select name="status" style="width: 120px;" data="{$status}">
        <option value="-1" >全部状态</option>  
        <option value="0" <eq name="status" value="0">selected</eq>>申请中</option>
        <option value="1" <eq name="status" value="1">selected</eq>>同意</option>
        <option value="2" <eq name="status" value="2">selected</eq>>拒绝</option>
        <option value="3" <eq name="status" value="3">selected</eq>>打款成功</option>
      </select> &nbsp;&nbsp; 
     	<input type="submit" class="btn btn-primary btn-sm" value="搜索" />
      <a class="btn btn-danger btn-sm" href="{:U('Finance/store_withdrawal')}">清空</a>
    </form>
 
    
      <table class="table table-hover table-bordered table-list">
        <thead>
          <tr>
          	<th width="50">ID</th>
            <th>转账订单号</th>
            <th>用户</th>
            <th>提现金额</th>
            <th>申请时间</th>
            <th>状态</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <foreach name="rs" item="vo">
          <tr>
            <td>{$vo.id}</td>
            <td>{$vo.order_num}</td>
            <td>{$vo.title}</td>
            <td>{$vo.money}</td>
            <td>{:date('Y-m-d H:i:s',$vo['time'])}</td>
            <td><php>if($vo['status']==0){echo '申请中';}if($vo['status']==1){echo '同意';}if($vo['status']==2){echo '拒绝 ';}if($vo['status']==3){echo '打款成功';}</php></td>
       			<td>
          	<php>if($vo['status']==0){</php>
         				<a href="{:U('Finance/store_withdrawal_edit',array('status'=>1,'id'=>$vo['id']))}">同意</a>
         				<a href="javascript:;" class="close_order" order_id="{$vo['id']}">拒绝</a>
          	<php>}</php>
          	<php>if($vo['status']==1){</php>
         				<a href="javascript:;" class="order_info" order_id="{$vo['id']}">打款</a>
         		<php>}</php>
         		<php>if($vo['status']==2){</php>
         				<a href="javascript:;">已拒绝</a>
         		<php>}</php>
         			<php>if($vo['status']==3){</php>
         				<a href="javascript:;">打款成功</a>
         		<php>}</php>
          </tr>
          </foreach>
        </tbody>
        <tfoot>
          
          <tr>
          	<th width="50">ID</th>
            <th>转账订单号</th>
            <th>用户</th>
            <th>提现金额</th>
            <th>申请时间</th>
            <th>状态</th>
            <th>操作</th>
          </tr>
       
        </tfoot>
      </table>
      <div class="pagination">{$page}</div>
   
  </div>
    </div>
   </div>
</div>

<script>
//全局变量
    var GV = {
         DIMAUB: "/",
        JS_ROOT: "NewAdmin/js/",
        TOKEN: ""
    };
</script>
<style type="text/css">
	.layui-layer-input {width: 100%;}
	html .layui-layer-demo{background-color:#eee;width: 20%;}
	.layui-layer-demo .layui-layer-title{border:none; background-color:#333; color:#fff;}
	.ali_value{float: right;width: 70%;}
	.ali_value input{width: 100%;}
	.ali_title{width: 90%;margin: 10px auto;}
	.ali_title label{width: 30%; line-height: 30px;}
	.ali_title  .btn{float: right;margin: 0 5px;}
</style>
<script src="/NewAdmin/js/wind.js"></script>
<link href="/NewAdmin/js/artDialog/skins/default.css" rel="stylesheet" />
<script src="/NewAdmin/js/zhlmy.js"></script>
<script src="/NewAdmin/js/zhlmy.js"></script>
<script src="/static/js/layer/layer.js"></script>
  <script>
    $(function() {

      $("#navcid_select").change(function() {
        $("#mainform").submit();
      });
      $('.close_order').click(function(){
      	var order_id=$(this).attr('order_id');
     	  close_order(order_id)
      })
      
      $('.order_info').click(function(){
      	var order_id=$(this).attr('order_id');
      	var url="{:U('Finance/store_order_info')}";
      	$.get(url, {id:order_id}, function(result){
				  layer.open({
					  type: 1,
					  skin: 'layui-layer-demo', //样式类名
					  closeBtn: 0, //不显示关闭按钮
					  anim: 2,
					  shadeClose: true, //开启遮罩关闭
					  title:"企业打款信息",
					  content: '<div>  <div class="ali_title"><label>支付宝账号</label>	<div class="ali_value"><input type="text" readonly value="'+result.ali_number+'" ></div> </div>   <div class="ali_title"><label>真实姓名</label>	<div class="ali_value"><input type="text" readonly value="'+result.ali_name+'" ></div> </div>   <div class="ali_title"><label>金额</label>	<div class="ali_value"><input type="text" readonly value="'+result.tixian+'" ></div> </div> <div class="ali_title" style="    float: left;"> <input type="button" order_id="'+order_id+'" class="btn btn-danger  btn-sm" value="打款失败"><input type="button" order_id="'+order_id+'" class="btn btn-primary btn-sm" value="打款成功"></div></div>'
					});
				 });
      })
			$('body').on('click','.ali_title .btn-danger', function() { 
				var order_id=$(this).attr('order_id');
				close_order(order_id);
			});
			$('body').on('click','.ali_title .btn-primary', function() { 
				var order_id=$(this).attr('order_id');
				var url="{:U('Finance/store_withdrawal_edit')}";
				 $.get(url, {id:order_id,status:3}, function(result){
						   location.reload();
				});
			});
			
		function close_order(order_id){
			var url="{:U('Finance/store_withdrawal_edit')}";
      	 layer.prompt({title: '请输入拒绝理由', formType: 2}, function(text, index){
				    layer.close(index);
				   	 $.get(url, { text:text,id:order_id,status:2}, function(result){
						   if(result==1){
						   		location.reload();
						   }else{
						   	layer.msg('拒绝失败！');
						   }
						 });
				  });
		}
    });
  </script>
<include file="Public:footer" />
